package com.ruoyi.web.controller.system;

import java.util.List;

import com.ruoyi.common.core.domain.entity.Waitforsign;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.IWaitforsignService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 临时签章（质检）Controller
 * 
 * @author ess
 * @date 2021-10-18
 */
@RestController
@RequestMapping("/system/Waitforsign")
public class WaitforsignController extends BaseController
{
    @Autowired
    private IWaitforsignService WaitforsignService;

    /**
     * 查询临时签章（质检）列表
     */
    @PreAuthorize("@ss.hasPermi('system:Waitforsign:list')")
    @GetMapping("/list")
    public TableDataInfo list(Waitforsign Waitforsign)
    {
        startPage();
        List<Waitforsign> list = WaitforsignService.selectWaitforsignList(Waitforsign);
        return getDataTable(list);
    }

    /**
     * 导出临时签章（质检）列表
     */
    @PreAuthorize("@ss.hasPermi('system:Waitforsign:export')")
    @Log(title = "临时签章（质检）", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Waitforsign Waitforsign)
    {
        List<Waitforsign> list = WaitforsignService.selectWaitforsignList(Waitforsign);
        ExcelUtil<Waitforsign> util = new ExcelUtil<Waitforsign>(Waitforsign.class);
        return util.exportExcel(list, "临时签章（质检）数据");
    }

    /**
     * 获取临时签章（质检）详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:Waitforsign:query')")
    @GetMapping(value = "/{uuid}")
    public AjaxResult getInfo(@PathVariable("uuid") String uuid)
    {
        return AjaxResult.success(WaitforsignService.selectWaitforsignByUuid(uuid));
    }

    /**
     * 新增临时签章（质检）
     */
    @PreAuthorize("@ss.hasPermi('system:Waitforsign:add')")
    @Log(title = "临时签章（质检）", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Waitforsign Waitforsign)
    {
        return toAjax(WaitforsignService.insertWaitforsign(Waitforsign));
    }

    /**
     * 修改临时签章（质检）
     */
    @PreAuthorize("@ss.hasPermi('system:Waitforsign:edit')")
    @Log(title = "临时签章（质检）", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Waitforsign Waitforsign)
    {
        return toAjax(WaitforsignService.updateWaitforsign(Waitforsign));
    }

    /**
     * 删除临时签章（质检）
     */
    @PreAuthorize("@ss.hasPermi('system:Waitforsign:remove')")
    @Log(title = "临时签章（质检）", businessType = BusinessType.DELETE)
	@DeleteMapping("/{uuids}")
    public AjaxResult remove(@PathVariable String[] uuids)
    {
        return toAjax(WaitforsignService.deleteWaitforsignByUuids(uuids));
    }
}
